<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/config.inc.php');
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/top.inc.php');

$semester_id = mysql_real_escape_string(strip_tags($_POST['id']));
$session_number = mysql_real_escape_string(strip_tags($_POST['session_num']));
$year = mysql_real_escape_string(strip_tags($_POST['year']));
$season_id = mysql_real_escape_string(strip_tags($_POST['season']));
$start_date = mysql_real_escape_string(strip_tags($_POST['start']));
$end_date = mysql_real_escape_string(strip_tags($_POST['end']));

echo "<h1>Add Semester</h1>";

$query2 = "UPDATE semesters
			SET year='$year',
				season_id='$season_id',
				session_number='$session_number',
				start_date='$start_date',
				end_date='$end_date'
			WHERE id='$semester_id'";
	
$result2 = mysql_query($query2);

if ($result2)
{
	echo "Semester has been successfully updated!";
	echo "<br />";
}
else
{
	echo "Semester was NOT able to be updated at this time!";
	echo "<br />";
}

//close
mysql_close();

echo "<p>";
	echo "<a href='index.php'>&lt;&lt; Back to Semesters Portal</a><br />";
echo "</p>";
?>

<?php
	require_once($_SERVER['DOCUMENT_ROOT'].'uno-course-scheduler/include/bottom.inc.php');
?>